package cn.git.shiro.test;

import org.apache.shiro.crypto.hash.Md5Hash;
import org.apache.shiro.crypto.hash.SimpleHash;

/**
 * @description:
 * @program: bank-credit-sy
 * @author: lixuchun
 * @create: 2024-03-26
 */
public class ShiroMD5 {
    public static void main(String[] args) {
        String password = "123456";
        // 使用md5加密
        Md5Hash md5Hash = new Md5Hash(password);
        System.out.println(md5Hash.toHex());

        // 加salt
        Md5Hash md5Hash1 = new Md5Hash(password, "3313");
        System.out.println(md5Hash1.toHex());

        // 加盐三次加密
        Md5Hash md5Hash2 = new Md5Hash(password, "3313", 3);
        System.out.println(md5Hash2.toHex());

        // 使用父类加密, 默认使用MD5
        SimpleHash simpleHash = new SimpleHash("MD5", password, "3313", 3);
        System.out.println(simpleHash.toHex());
    }
}
